package com.chen.apipassenger.controller;

import com.chen.apipassenger.remote.ServiceOrderClient;
import com.chen.internalcommon.dto.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author chenLiuPing
 **/
@RestController
public class TestController {
    @GetMapping("/test")
    public String test() {
        return "api-passenger test";
    }

    /**
     * 需要token
     * @return
     */
    @GetMapping("/authTest")
    public ResponseResult authTest() {
        return ResponseResult.success();
    }


    /**
     * 不需要token
     * @return
     */
    @GetMapping("/noauthTest")
    public ResponseResult noAuthTest() {
        return ResponseResult.success();
    }

    @Autowired
    private ServiceOrderClient serviceOrderClient;
    /**
     * 并发测试实时订单
     * @param orderId
     * @return
     */
    @GetMapping("/test-real-time-order/{orderId}")
    public String dispatchRealTimeOrder(@PathVariable("orderId") long orderId) {
        System.out.println("并发测试：orderId:" + orderId);
       return serviceOrderClient.dispatchRealTimeOrder(orderId);
    }
}
